/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ar.com.tracking.navegacion_core.model;

/**
 *
 * @author Cuni
 */
public class Suspended extends OrderState{
    
    private OrderState previousState;
    
     /**
     * @return the previousState
     */
    public OrderState getPreviousState() {
        return previousState;
    }

    /**
     * @param previousState the previousState to set
     */
    public void setPreviousState(OrderState previousState) {
        this.previousState = previousState;
    }
    
    public Suspended(OrderState previousState){
        this.previousState = previousState;
    }
    
 @Override
 public void cancelOrder(Order order) {
     OrderState newState = new Canceled();
     order.setState(newState);
 }
 
  @Override
  public void reviewOrder(Order order){
      order.setState(this.getPreviousState());
  }

  @Override
    public String toString() {
            return "Suspended";
    }
 
}
